include layout/header.jade
div.page-content
  div.row
    div.col-md-12
      div.portlet.box.blue
        div.portlet-title
          div.caption 课程管理
          div.actions
            a.btn.green(href="/admin/lession/add") 新增
        div.portlet-body
          div.portlet-body(style="padding-bottom:10px")
            form#searchForm.form-inline(role="form",action="/admin/lession",method="get")
              div.form-group
                input.form-control(type="text",placeholder="课程名",name="name")
              button#searchButton.btn.text-right.btn-success(type="submit") 查询
          table#datatable.table.table-striped.table-bordered.table-hover(data-url="/admin/ajax/lession")
            thead
              tr
                th(data-name="lessionname") 课程名
                th(data-name="create_time") 创建时间
                th(data-name="_id") 操作
script(type='text/javascript').
      aoColumnDefs = [{
                    "mRender": function ( data, type, row ) {
                        return "<a class='btn green' href='/admin/lession/add?id="+row['_id']+"'>修改</a>"
                        +"<a class='btn red' href='/admin/lession/delete?id="+row['_id']+"'>删除</a>"
                        +"<a class='btn yellow' href='/admin/lession/comment?id="+row['_id']+"'>评论</a>";
                    },
                    "aTargets": [2]
                }];
include layout/footer.jade
script(type='text/javascript').
      $(document).ready(function(){
        $("#datatable").on('click','.active',function(){
            var item = $(this);
            console.log(11)
            $.get("/user/active?id="+$(this).attr("data-id")).success(function(){
                item.parent().html('已经激活');
              })
          });
      });
